package com.ld.poetry.export;

import com.alibaba.excel.write.metadata.WriteSheet;
import com.foxchen.offline.task.ExportHandler;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component("test-little-export")
public class TestExportLittle extends ExportHandler {
    @Override
    public Pair<Long, Long> getTotalAndSingleBatch(Integer integer) {
        return Pair.of(100000L,10000L);
    }

    @Override
    public List<WriteSheet> getSheetList() {
        List<WriteSheet> sheetList = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            WriteSheet sheet = new WriteSheet();
            sheet.setSheetName(i + 1 + "");
            sheet.setSheetNo(i + 1);
            sheetList.add(sheet);
        }
        return sheetList;
    }

    @Override
    public List<?> pageGetSheetData(Integer sheetNo, Long pageNum, Long pageSize) {
        List<List<String>> dataList = new ArrayList<>();
        for (int i = (pageNum.intValue() - 1) * pageSize.intValue(); i < pageNum * pageSize; i++) {
            List<String> rowData = new ArrayList<>();
            for (int i1 = 0; i1 < 20; i1++) {
                rowData.add((i + 1) + "-" + (i1 + 1));
            }
            dataList.add(rowData);
        }
        return dataList;
    }
}
